﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class TEKK02
    {

        public TEKK02()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VEKKOPF();
            this.DataContext = MV; 
            InitializeComponent();
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwEKK = dwMaster;
            if (dwMaster == null)
            {
                KEY = "";
                AUF = "";
            }
            else
            {
                KEY = dwMaster["EKKAUFKRS"].ToString() + dwMaster["EKKAUFLFD"].ToString();
                AUF = "B" + dwMaster["EKKAUFKRS"].ToString() + dwMaster["EKKAUFLFD"].ToString() + "000" + LIEFNR.PadRight(8);
            }
        }
        public override void OnLIEFNRBYChg(string value)
        {
            TBMain.Clear();
            if (value.Length < 8)
                return;
            dwData = TBMain.NewRow();
            dwData["EKKMANDANT"] = app.Mandant;  
            dwData["EKKLIEFNR"] = value;
            SResult =TMV.QueryEKKOPF(dwData, 4);
            MergeData(SResult, false);
            base.OnLIEFNRBYChg(value);
        } 
 
    }
}
